<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false"%>
 <%@ taglib prefix="gly" uri="http://java.sun.com/jsp/jstl/core" %>
  <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="lg" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cookie.js"></script>
</head>
<body>
<div class="x-nav">
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        刷新</a>
    </div>
<form  enctype="multipart/form-data" class="form-horizontal" id="form1" role="form" style="width: 550px;margin: 10px auto;" action="${pageContext.request.contextPath}/staff/saveStaff"  method="post" >  
				    <div class="form-group">
					    <label for="staff_code" class="col-sm-3 control-label">员工编号</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="staff_code" placeholder="请输入编号" name="staff_code">
					    </div>
					    
				   </div>
				   <div class="form-group">
					    <label for="staff_name" class="col-sm-3 control-label">员工姓名</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="staff_name" placeholder="请输入姓名" name="staff_name">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="sex" class="col-sm-3 control-label">员工性别</label>
					    <div class="col-sm-3">
						    <select name="sex" id="sex">
						    	<option value ="男">默认(男)</option>
							  <option value ="男">男</option>
							  <option value ="女">女</option>
							</select>
						</div>
				   </div>
				     <div class="form-group">
					    <label for="card" class="col-sm-3 control-label">员工身份证号</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="card" placeholder="请输入身份证号" name="card">
					    </div>
				   </div>
				    <div class="form-group">
					    <label for="natives" class="col-sm-3 control-label">员工籍贯</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="natives" placeholder="请输入籍贯" name="natives">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="date" class="col-sm-3 control-label">员工生日</label>
					    <div class="col-sm-9">
					      <input type="date" style="width:200px;" class="form-control" id="date"  name="date">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="age" class="col-sm-3 control-label">员工年龄</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="age" placeholder="请输入年龄" name="age">
					    </div>
				   </div>
				     <div class="form-group">
					    <label for="nation" class="col-sm-3 control-label">员工民族</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="nation" placeholder="请输入民族" name="nation">
					    </div>
				   </div>
				    <div class="form-group">
					    <label for="political" class="col-sm-3 control-label">政治面貌</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="political" placeholder="请输入政治面貌" name="political">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="marry" class="col-sm-3 control-label">婚否</label>
					    <div class="col-sm-4">
					    	<select name="marry" id="marry">
					    		<option value ="未婚">选择(默认未婚)</option>
							  <option value ="未婚">未婚</option>
							  <option value ="已婚">已婚</option>
							</select>
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="computer" class="col-sm-3 control-label">计算机等级</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="computer" placeholder="请输入计算机等级" name="computer">
					    </div>
				   </div>
				     <div class="form-group">
					    <label for="language" class="col-sm-3 control-label">英语等级</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="language" placeholder="请输入英语等级" name="language">
					    </div>
				   </div>
				    <div class="form-group">
					    <label for="degree" class="col-sm-3 control-label">员工学历</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="degree" placeholder="请输入员工学历" name="degree">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="email" class="col-sm-3 control-label">员工邮箱</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="email" placeholder="请输入邮箱" name="email">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="email" class="col-sm-3 control-label">员工家庭住址</label>
					    <div class="col-sm-9">
					    <div class="layui-row">
					           <div class="layui-form-item" id="x-city">
					            <div class="layui-input-inline">
					              <select id="province" lay-filter="province">
					                <option value="">请选择省</option>
					              </select>
					            </div>
					            <div class="layui-input-inline">
					              <select id="city" lay-filter="city">
					                <option value="">请选择市</option>
					              </select>
					            </div>
					            <div class="layui-input-inline">
					              <select id="area" lay-filter="area">
					                <option value="">请选择县/区</option>
					              </select>
					            </div>
					             <input type="text" style="width:200px;" class="form-control"  placeholder="详细信息" id="mess">
					          </div>
					    </div>
					    </div>
				   </div>
				     <div class="form-group">
					    <label for="specialty" class="col-sm-3 control-label">员工爱好</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="specialty" placeholder="请输入爱好" name="specialty">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="myHeadimg2"  class="col-sm-3 control-label">员工证件照</label>
					    <div class="col-sm-9">
					      <input type="file" id="myHeadimg2" name="myHeadimg2"/>
					    </div>
					</div>
				   <div class="form-group">
					    <label for="state" class="col-sm-3 control-label">员工状态</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="state" placeholder="请输入状态" name="state">
					    </div>
				   </div>
				   <div class="form-group">
					    <label for="specialty" class="col-sm-3 control-label">员工爱好</label>
					    <div class="col-sm-9">
					      <input type="text" style="width:200px;" class="form-control" id="specialty" placeholder="请输入爱好" name="specialty">
					    </div>
				   </div>
				   <div class="form-group">
				    <label for="inputEmail3" class="col-sm-3 control-label">员工部门</label>
				    <div class="col-sm-9">
					    <select name="dept_id" id="dept_id">
					    		<option value ="">选择</option>
					    	<lg:forEach items="${dept}" var="d">
					    		<option value ="${d.dept_id}">${d.dept_name}</option>
					    	</lg:forEach>
						</select>
				    </div>
	   			</div>
	   			<div class="form-group">
				    <label for="inputEmail3" class="col-sm-3 control-label"></label>
				    <div class="col-sm-9">
				    	<input  id="add_role_btn" class="btn btn-info col-sm-12" value="保存" type="submit"/>
				    	<input  id="btn222" class="btn btn-info col-sm-12" value="不提交保存" />
				    </div>
	   			</div>
	</form>
 	<script src="${pageContext.request.contextPath}/static/js/jquery-1.12.3.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js" type="text/javascript"></script>				
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xcity.js"></script>
<script type="text/javascript">
/* $("#add_role_btn").click(function(){
	$.ajax({
		url:"${pageContext.request.contextPath}/staff/saveStaff",
		type:"post",
		async:true,
		data:$("#form1").serialize(),
		success:function(data){
			window.location.href="${pageContext.request.contextPath}/staff/staff-list.jsp";
		}
	}); 
	
}); */
layui.use(['form','code'], function(){
    form = layui.form;

    layui.code();

    $('#x-city').xcity('广东','广州市','东山区');

  });
$(function(){
	  $("#btn222").click(function(){
		  alert("进来了");
		  var oOpt = document.getElementById('province').value;
		  oOpt = oOpt+document.getElementById('city').value;
		  oOpt = oOpt+document.getElementById('area').value;
		  oOpt = oOpt+document.getElementById('mess').value;
		  var formData = new FormData();
		  formData.append('myHeadimg2', $(':input[name=myHeadimg2]')[0].files[0]);
		  formData.append('staff_code',$("#staff_code").val());
		  formData.append('staff_name',$("#staff_name").val());
		  formData.append('sex',$("#sex").val());
		  formData.append('card',$("#card").val());
		  formData.append('natives',$("#natives").val());
		  formData.append('date',$("#date").val());
		  formData.append('age',$("#age").val());
		  formData.append('nation',$("#nation").val());
		  formData.append('political',$("#political").val());
		  formData.append('marry',$("#marry").val());
		  formData.append('computer',$("#computer").val());
		  formData.append('language',$("#language").val());
		  formData.append('degree',$("#degree").val());
		  formData.append('email',$("#email").val());
		  formData.append('address',oOpt);
		  formData.append('specialty',$("#specialty").val());
		  formData.append('state',$("#state").val());
		  formData.append('array',new Array(1,2,3,4));
		  $.ajax({
		      url:'saveStaff2',
		      type:'post',
		      dataType:"json",
		      cache:false,
		      data:formData,
		      processData:false,
		      contentType:false,
		      success:function(response){
		    	  window.location.href="${pageContext.request.contextPath}/staff/staff-list.jsp";
		      },
		      error:function(response){
		      }
		  })
	  });
})

</script>
</body>
</html>